/**
 * 
 */
package com.ihg.hiex.entity.session;

import org.apache.commons.lang3.StringUtils;

import com.demo2do.core.utils.Alias;

/**
 * @author downpour
 *
 */
@Alias("SessionStatus")
public enum Status {
    
    NOTSTARTED("编辑中", "NOT STARTED", "not start"),
    
    ACTIVE("进行中", "ACTIVE", "active"),
    
    HISTORY("已完成", "HISTORY", "history"),
    
    CLOSE("已关闭", "CLOSE", "close");

    private String description;
    
    private String alias;
    
    private String name;
    
    /**
     * 
     * @param description
     * @param alias
     * @param name
     */
    Status(String description, String alias, String name) {
        this.description = description;
        this.alias = alias;
        this.name = name;
    }

    /**
     * 
     * @param alias
     * @return
     */
    public static Status aliasOf(String alias) {
        for(Status sessionStatus : Status.values()) {
            if(StringUtils.equalsIgnoreCase(sessionStatus.getAlias(), alias)) {
                return sessionStatus;
            }
        }
        return null;
    }
    
    /**
     * 
     * @return
     */
    public boolean isNotStart() {
        return this.equals(Status.NOTSTARTED);
    }
    
    /**
     * 
     * @return
     */
    public boolean isActive() {
        return this.equals(Status.ACTIVE);
    }
    
    /**
     * 
     * @return
     */
    public boolean isHistory() {
        return this.equals(Status.HISTORY);
    }
    
    /**
     * @return the description
     */
    public String getDescription() {
        return this.description;
    }
    
    /**
     * 
     * @return
     */
    public String getAlias() {
        return alias;
    }
    
    /**
     * 
     * @return
     */
    public String getName() {
        return name;
    }
    
}
